package com.x.erp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.ColorDao;
import com.x.erp.model.Color;
import com.x.erp.rpc.ColorRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;

@Component
@Service(interfaceName = "com.x.erp.rpc.ColorRpcService", timeout = 60000)
public class ColorService extends BaseService implements ColorRpcService{
	
	@Autowired
	private ColorDao colorDao;
	
	/**
	 * 查询颜色列表
	 * @param color
	 * @return
	 */
	@Override
	public List<Color> selectColorList(Color color) {
		try {
			return colorDao.selectColorList(color);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}
	
	/**
	 * 新增颜色
	 * @param color
	 * @return
	 */
	@Override
	public Color insertColor(Color color) {
		try {
			return this.insertColor(color);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}
	
	/**
	 * 编辑颜色
	 * @param color
	 * @return
	 */
	@Override
	public Integer updateColor(Color color) {
		try {
			return this.updateColor(color);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
